package com.zte.user.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zte.user.dao.IUserDao;
import com.zte.user.model.SmbmsUser;
import com.zte.user.model.UserCondition;
import com.zte.user.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService implements IUserService {

    @Autowired
    private IUserDao userDao;

    @Override
    public List<SmbmsUser> getUserListByCondition(UserCondition conn) {
        return userDao.getUserListByCondition(conn);
    }

    @Override
    public PageInfo<SmbmsUser> getUserPageByCondition(PageInfo<SmbmsUser> info, UserCondition conn) {
        PageHelper.startPage(info.getPageNum(),info.getPageSize());
        List<SmbmsUser> userList = userDao.getUserListByCondition(conn);
        PageInfo<SmbmsUser> pageInfo = new PageInfo<SmbmsUser>(userList);
        return pageInfo;
    }
}
